﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Burn4You
{
    public partial class FrmConfig : Form
    {
        #region Variables
        
        public static Burn4YouSettings settings = null;

        #endregion

        #region Functions
        
        public FrmConfig()
        {
            InitializeComponent();

            LoadSettings();

        }

        protected override void OnClosing(CancelEventArgs e)
        {
            SaveSettings();

            base.OnClosing(e);
        }

        void LoadSettings()
        {
            settings = new Burn4YouSettings();


            tbCDRecordLoc.Text = settings.ExeLocCDReader;
            tbDVDAuthorLoc.Text = settings.ExeLocDvdAuthor;
            tbFFMpegLoc.Text = settings.ExeLocFFmpeg;
            tbMkisofsLoc.Text = settings.ExeLocMkisofs;
            tbWorkingFolder.Text = settings.WorkingFolder;
            cbFormat.Text = settings.DefaultFormat;

        }

        void SaveSettings()
        {
            using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml"))
            {
                settings.ExeLocCDReader = tbCDRecordLoc.Text;
                settings.ExeLocDvdAuthor = tbDVDAuthorLoc.Text;
                settings.ExeLocFFmpeg = tbFFMpegLoc.Text;
                settings.ExeLocMkisofs = tbMkisofsLoc.Text;
                settings.WorkingFolder = tbWorkingFolder.Text;
                settings.DefaultFormat = cbFormat.Text;
            }
        }

        #endregion

        private void button2_Click(object sender, EventArgs e)
        {

        }
    }


}
